require('normalize.css/normalize.css');

import React from 'react';
import {Link} from 'react-router';

import '../styles/main.css';

import Notice from '../components/index/Notice';
import User from '../components/index/User';
import Menu from '../components/index/Menu';
import BottomBanner from '../components/index/BottomBanner';
import login from '../actions/login';
let yeomanImage = require('../images/yeoman.png');

console.log("this is main react");
/*初始化数据*/
var notices = [
  {id: '1', topic: '果品大方仓~~各种活动计划1~哈哈哈哈', date: '2016年12月19日'},
  {id: '2', topic: '果品大方仓~~各种活动计划2~哈哈哈哈', date: '2016年12月19日'},
  {id: '3', topic: '果品大方仓~~各种活动计划3~哈哈哈哈', date: '2016年12月19日'}

];
class Main extends React.Component {
  constructor() {
    console.log("this is main constructor");
    super();
      var isLogin = login.isLogin();
    var vendorInfo = window.localStorage.getItem('vendorInfo');
    var user = window.localStorage.getItem('user');
    this.state = {
      noticeList: notices,
      vendorInfo:JSON.parse(vendorInfo),
      user:JSON.parse(user),
      isLogin:isLogin
    };
  }

  render() {
    return (
      <div className="full">
        <User isLogin={this.state.isLogin} user={this.state.user} vendorInfo={this.state.vendorInfo}/>
        <Notice notices={this.state.noticeList}/>
        <div style={{height:'1.5rem',width:'100%',backgroundColor:'#f0f0f0'}}></div>
        <Menu/>
        <div style={{height:'1.5rem',width:'100%',backgroundColor:'#f0f0f0'}}></div>
        <BottomBanner/>
      </div>
    );
  }
}

Main.defaultProps = {};

export default Main;
